<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <!-- <link rel="stylesheet" type="text/css" href="../css/style.css" /> -->
    <link rel="stylesheet" type="text/css" href="../css/aui-slide.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
    <style>
        [ v-cloak] {
            display: none;
        }

        .aui-bar-nav {
            background-color: #FFF;
            color: #000;
        }

        .tod_os {
            display: flex;
        }

        .tod_text {
            position: relative;
            /*left: -28px*/
        }

        #aui-slide2 {
            width: 200px;
        }

        #aui-slide3 {
            width: 100%;
        }

        .scrollDiv {
            width: 340px;
            height: 40px;
            margin: auto;
        }

        .scrollDiv>div {
            width: 240px;
            height: 40px;
            overflow: hidden;
        }

        .scrollDiv ul {
            height: 200px;
            position: relative;
            animation: dh 9s infinite 3s;
            box-sizing: border-box;
        }

        @keyframes dh {
            0% {
                transform: translatey(0px);
            }

            10% {
                transform: translatey(-40px);
            }

            33% {
                transform: translatey(-40px);
            }

            42% {
                transform: translateY(-80px);
            }

            67% {
                transform: translateY(-80px);
            }

            76% {
                transform: translateY(-120px);
            }

            100% {
                transform: translateY(-120px);
            }
        }

        .scrollDiv ul>li {
            width: 260px;
            height: 40px;
            line-height: 40px;
        }

        .scrollDiv ul span {
            font-size: 13px;
            color: #666666;
            width: 160px;
        }

        .tod_os>div:nth-child(1) {
            width: 120px;
            line-height: 40px;
        }

        .tod_os_a {
            display: flex;
            height: 40px;
            line-height: 40px;
        }

        .tod_os_a img {
            width: 16px;
            height: 16px;
            margin-top: 10px;
        }

        .right {
            display: flex;
            align-items: center;
            box-sizing: border-box;
            padding-left: 5px;
        }

        .right>span:first-child {
            width: 20px;
            height: 20px;
            line-height: 21px;
            text-align: center;
            border-radius: 50%;
            background: #F74C5C;
            color: #fff;
            font-size: 11px;
            margin-right: 5px;
        }

        .top>div:first-child {
            width: 4.15rem;
            font-size: 19px;
            font-family: PingFang SC;
            font-weight: bold;
            color: #000000;
            line-height: 12px;
            text-align: center;
            margin-left: 50%;
            transform: translateX(-50%);

        }

        .index {
            margin-top: 2rem;
            width: 100%;
            box-sizing: border-box;
            padding: 0 10px;
        }

        .index .top-box {
            padding: 3% 1px;
            height: 7rem;
            width: 100%;
            background-color: #fff;
            box-shadow: 0px 0px 9px 0px rgba(144, 144, 144, 0.16);
            background-size: 100% 100%;
            border-radius: 15px;
        }

        .index .top-box .row {
            display: flex;
            width: 100%;
            justify-content: space-between;
        }

        .index .top-box .top {
            padding-top: 0.4rem;
            justify-content: space-between;
            align-items: center;
        }

        .index .top-box .top img {
            width: 2rem;
            height: 2rem
        }

        .index .top-box .top .right {
            width: 5rem;
            height: 1.6rem;
            line-height: 1.6rem;
            text-align: center;
            font-size: 0.75rem;
            color: #F3345A;
            background: rgba(255, 255, 255, 1);
            border-radius: 0.8rem 0 0 0.8rem;
        }

        .index .top-box>h2 {
            text-align: left;
            text-align: center;
            font-size: 1.8rem;
            color: #FF7129;
        }

        .index .top-box>p {
            font-size: 0.7rem;
            text-align: center;
            color: #FFDBA2;
        }

        .index .top-box .bottom {
            color: #FF7129;
            font-size: 0.75rem;
            align-items: center;
        }

        .index .top-box .bottom>div {
            width: 50%;
            text-align: center;
        }

        .index .top-box .bottom>div:first-child {
            border-right: 1px solid #FFF;
        }

        .index .top-box .bottom span {
            color: #FF7129;
        }

        .index .content>h3 {
            font-size: 0.85rem;
            font-weight: bold;
            color: #333;
        }

        .index .content>div {
            display: flex;
            height: 10rem;
            justify-content: space-between;
            width: 100%;
            box-sizing: border-box;

        }

        .index .content .top {
            width: 30%;
            height: 9.4rem;
            margin-top: 0.3rem;
            margin-left: 0.3rem;
            background-image: url(../image/01/7.png);
            background-size: 100% 100%;
            background-repeat: no-repeat;
            box-sizing: border-box;
            padding: 20px 0 0;
        }

        .top+div {
            width: 65%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: center;
            color: #fff;
        }

        .top+div>div {
            box-sizing: border-box;
            position: relative;
            padding: 15px 10px 15px 20px;
        }

        .top+div>div img {
            width: 60px;
            position: absolute;
            top: 20px;
            right: 15px;
        }

        .top+div>div h3 {
            background-color: red;
            font-size: 17px;
            font-weight: bold;
        }

        .top+div>div h3+p {
            color: #fff;
            font-size: 14px;
            margin-top: 10px;
        }

        .right_t {
            height: 100px;
            width: 100%;
            border-radius: 15px;
            background: url('../image/01/5.png') no-repeat 100%/100%
        }

        .right_b {
            height: 100px;
            width: 100%;
            border-radius: 15px;
            background: url('../image/01/6.png') no-repeat 100%/100%
        }

        .index .content .top>h3 {
            position: relative;
            font-size: 1rem;
            color: #fff;
            margin-bottom: 0.6rem;
            font-weight: bold;
            width: 100%;
            text-align: center;
        }

        .index .content .top>h3+p {
            height: 26px;
            width: 50%;
            margin: auto;
            border-radius: 13px;
            text-align: center;
            line-height: 26px;
            background: #fff;
            color: #FFC51E;
            margin-top: 5px;
        }

        /*.index .content .top>h3:before{
          content: '';
          position: absolute;
          top: 50%;
          transform: translateY(-50%);
          width: 0.2rem;
          height: 1rem;
          border-radius: 0.1rem;
          background-color: #CFD9FF;
          left: -0.6rem;
        }*/

        .index .content .top>p {
            font-size: 0.8rem;
            color: #CFD9FF;
        }

        .index .content .bottom {
            margin-top: 1rem;
            display: flex;
            justify-content: space-between;
            width: 100%;
            background-image: url(../image/zu3.png);
            background-size: 100% 100%;
            border-radius: 15px;
            height: 6rem;
            box-sizing: border-box;
            padding-right: 20px;
            align-items: center;
        }

        .index .content .bottom>div {
            border-radius: 0.2rem;
        }

        /*.index .content .bottom>div:first-child{
          background-image: url(../image/51.png);
          background-size: 100% 100%;
          box-shadow: 0 0 18px rgba(255, 126, 82,0.8);
        }*/

        .index .content .bottom>div:last-child {
            background-image: url(../image/61.png);
            background-size: 100% 100%;
            box-shadow: 0 0 18px rgba(255, 102, 113, 0.8);
        }

        .index .content .bottom h3 {
            font-size: 1rem;
            color: #fff;
            padding-left: 1.2rem;
            font-weight: bold;
            position: relative;
        }

        .index .content .bottom span {
            padding-left: 1.2rem;
            display: block;
            margin-top: 20px;
            color: #fff;
        }

        .index .content .bottom img {
            width: 70px;
        }

        .herder_bgc {
            width: 100%;
            height: 9.62rem;
            background: url('../image/01/1.png') no-repeat 100%/100%;
        }

        #header {
            color: #fff;
            background: none
        }

        .swiper-container {
            width: 95%;
            height: 7.47rem;
            border-radius: 10px;
        }

        .swiper-slide {
            width: 18.66rem;
            height: 7.47rem;
            border-radius: 10px;
        }

        .swiper-slide>img {
            width: 18.66rem;
            height: 7.47rem;
        }

        ._top {
            width: 100%;
        }

        ._top>span {
            font-size: 0.9rem;
            color: #000000;
            font-weight: bold;
            font-family: PingFang SC;
        }

        .bg_yq {
            margin: 0 auto;
            width: 100%;
            height: 6.75rem;
            background: url('../image/01/8.png') no-repeat 100%/100% !important
        }

        .bg_kf {
            margin: 0 auto;
            width: 100%;
            height: 6.75rem;
            background: url('../image/01/4.png') no-repeat 100%/100% !important
        }

        body {
            margin-top: -10px;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div class="herder_bgc">
            <header id="header" data-color="dark" class="aui-bar aui-bar-nav">猫猫试玩</header>
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <div class="swiper-slide">
                        <img src="../image/01/2.png" alt="">
                    </div>
                    <div class="swiper-slide">
                        <img src="../image/01/2.png" alt="">
                    </div>
                </div>
            </div>
        </div>

        <div class="aui-content index">
            <div class="top-box">
                <div class="row top">
                    <div tapmode onclick="openWin('home')">今日收益</div>
                    <div tapmode onclick="openWin('home')" class="right"
                        style="background-color: rgba(255, 120, 45, 0.2)">
                        <span>￥</span><span>立即提现</span>
                    </div>
                </div>
                <h2 id="tod_money">0.00</h2>
                <div class="row bottom" id="money">
                    <div>累计收益：<span>0.00元</span></div>
                    <div>账户余额：<span>0.00元</span></div>
                </div>
            </div>
            <div class="tod_os">
                <!-- <div v-for="(item,index) in os_list" :key="index">
                        {{item.notice_title}}
                      </div> -->
                <div class="tod_os_a">
                    <img src="../icon/lab.png" alt="">系统公告:
                </div>
                <div class="scrollDiv">
                    <div>
                        <ul>
                            <li v-for="item in oslist" @click="gettolist(item.id)">
                                <span>{{item.notice_title}}</span>
                            </li>
                        </ul>
                    </div>
                </div>

            </div>
            <div class="content">
                <h3 >任务试玩</h3>
                <div>
                    <div class="top" tapmode onclick="opentrWin()">
                    </div>
                    <div>
                        <div class="right_t" tapmode onclick="gogame()">
                        </div>
                        <div class="right_b" tapmode onclick="gourl()">
                        </div>
                    </div>
                </div>

            </div>
            <div class=" _top">
                <span>热门推荐</span>
                <div class=" bg_yq" tapmode onclick="openMq()">

                </div>
                <div class=" bg_kf" tapmode onclick="openWin('rec')">

                </div>
            </div>
        </div>
    </div>
    <div style="height: 50px"></div>
    </div>
</body>
<script type="text/javascript" src="../script/vue.js"></script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/app.js"></script>
<script type="text/javascript" src="../script/meiqia.js"></script>
<script type="text/javascript" src="../script/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../script/md5.min.js"></script>
<script type="text/javascript" src="../script/jquery.base64.js"></script>
<script type="text/javascript" src="../script/aui-slide.js"></script>
<script type="text/javascript" src="../script/swiper.min.js"></script>
<script type="text/javascript">
    var countdown = 60,
        udid_ = '',
        MtId_, AppKey_, MtIDUser_,
        idfa_; //

    apiready = function () {
        /*var toutiaoAd = api.require('toutiaoAd');
        toutiaoAd.splash({codeId:'887425863'});
        toutiaoAd.bannerExp({
        "codeId":"945764311",
        "rect":{
            "w": api.winWidth-18,
            "h": 200,
            "x":9,
            "y":54,
        },
        "fixed": true
    }, function(ret, err){
        console.log("###" + JSON.stringify(ret));
        //alert()
    })*/

        vm = new Vue({
            el: "#app",
            data: {
                oslist: "",
                token_api:'',
                udid: '',
                user:{}

            },
            methods: {
                gettolist(e) {
                    console.log(e)
                    api.openWin({
                        name: 'page1',
                        url: './oslist.html',
                        pageParam: {
                            id: e
                        }
                    });
                }
            },
            filters: {}

        })
        var systemVersion = api.systemVersion;
        if (systemVersion == 10) {
            var mitt = api.require('mitt');
            if (mitt) {
                mitt.initEntry({}, function (ret, err) { });
            }
        }
        if ($api.getStorage('token')) {
            getPageInit();
            tad_os();
        } else {
            out();
            openWin('login', null, false);
            api.closeFrame();
        }

        if (vm.token_api!='') {
            $api.setStorage('token_api', vm.token_api);
        }else{
            var u=$api.getStorage('user')
            u=JSON.parse(u)
            vm.user=u
            console.log(JSON.stringify(u))
            
            _ajax("index/get_api_token",function(ret,err){
                if(ret){
                    $api.setStorage('token_api', ret.data.token);
                    vm.token_api=ret.data.token
                }
            },{device:api.systemType,device_info:api.deviceId,target_id:u.id})
        }
    
       
        //载入美洽客服
        mq = api.require('meiQia');
        initHeard();
        _downRefresh(function () {
            getPageInit();
            tad_os();
            api.refreshHeaderLoadDone();
        });
        // api.addEventListener({
        //     name: 'viewappear'
        // }, function(ret, err) {
        //     getPageInit();
        // });
        var slide3 = new auiSlide({
            container: document.getElementById("aui-slide3"),
            "height": 30,
            "speed": 500,
            "autoPlay": 3000, //自动播放
            "loop": true,
            "pageShow": true,
            "pageStyle": 'line',
            'dotPosition': 'center'
        })
        api.addEventListener({
            name: 'appintent'
        }, function (ret, err) {
            var appParam = ret.appParam;

            if (!appParam.udid) {
                alert('请先获取UDID')
            } else {
                vm.udid = appParam.udid
                _ajax("user/setUdid", {
                    udid: appParam.udid
                }, function (res, err) {
                    if (res) {
                        console.log('518' + JSON.stringify(res));
                        getPageInit()

                    } else {
                        console.log('527' + JSON.stringify(err))
                    }
                })
            }
        });
        var browser = api.require('webBrowser');
        browser.historyBack(
            function (ret, err) {
                console.log(JSON.stringify(ret))
                if (!ret.status) {
                    // 标记 2020-12-04 安卓会退出 原因未知
                    if (api.systemType == 'ios') {
                        api.closeWin();
                    }

                }
            }
        );
        var swiper = new Swiper('.swiper-container', {
            loop: true,
            observer: true,
            observeParents: true,
            autoplayDisableOnInteraction: false,
            autoplay: {
                delay: 5000,
                disableOnInteraction: false,
            },
        });
   
    };

    function tad_os() {
        _ajax("index/notice", function (res, err) {
            if (res) {
                // vm.oslist = res.data;
                console.log(JSON.stringify(res))
                var scrollData = res.data
                if (scrollData != null) {
                    console.log(JSON.stringify(scrollData))
                    var item1 = scrollData[Math.floor(Math.random() * scrollData.length)]
                    var item2 = scrollData[Math.floor(Math.random() * scrollData.length)]
                    var item3 = scrollData[Math.floor(Math.random() * scrollData.length)]
                    var item4 = item1
                    vm.oslist = {
                        item1,
                        item2,
                        item3,
                        item4
                    }
                    console.log(JSON.stringify(vm.oslist));
                }
            } else {
                _msg("网络错误");
            }
        })
    }

    function openMq() {
        var userInfo = $api.getStorage('user');
        tapService(userInfo.id);
    }

    //获取首页信息
    function getPageInit() {
        api.parseTapmode();
        _ajax("index/income",  function (res, err) {
            if (res) {
                if (res.errCode == 1) {
                    console.log('571' + JSON.stringify(res))
                    vm.udid = res.data.udid
                    udid_ = res.data.udid
                    MtId_ = res.data.Mtid
                    MtIDUser_ = res.data.uid
                    AppKey_ = res.data.Mtkey
                    // alert(udid + '-' + MtIDUser + '-' + MtId + '-' + AppKey)
                    var info = res.data;
                    if (info.mqkey != '')
                        initServer(info.mqkey);
                    // alert()
                    if (info.todat_money != null && info.todat_money != '') {
                        $("#tod_money").html(Number(info.todat_money).toFixed(2)); //今日收益
                    }
                    if (info.sum_money != null && info.sum_money != '') {

                        $("#money span").eq(0).html(Number(info.sum_money).toFixed(2) + "元");
                    }
                    if (info.user_money != null && info.user_money != '') {
                        $("#money span").eq(1).html(Number(info.user_money).toFixed(2) + "元");
                    }
                } else if (res.errCode == -1) {
                    openWin('login');
                } else {
                    _msg(res.msg);
                }
            } else {
                _msg("网络错误");
            }
        })
    };
    function gourl() {
        var a='53-'+'7ae1ef9078814a65af757f3db8583fc8'+':sdkUserId='+vm.user.id+'&';
        var s=md5(a).toUpperCase()
        api.openWin({
            name: 'main_goUrl',
            url: './main_goUrl.html',
            pageParam:{
                url:'https://sdkh5.gouzixsw.com/#/?channelId=53&userId='+vm.user.id+'&sign='+s
            }

        });
        // to_page("http://app.desjoin.com/app/index/youxi",'游戏列表');
        // api.openWin({
        //     name: 'main_goUrl',
        //     url: './main_goUrl.html',

        // });

        if (api.systemType == 'ios'){
            _msg('三方任务，需要对接');
            return
        }
        renwu('play', '游戏试玩')

    }

    function get_api_token(){
        api.ajax({
            url:'https://api.aibianxian.net/igame/api/v1.0/cplApi/access',
            method: 'POST',
            
            headers: {
                        // 'Content-Type': 'application/json;charset=utf-8',
                        // 'token':ttoken
                    },
            data:{
                values:{
                        app_key : "142793069",
                        device : api.systemType,
                        device_info : api.deviceId,
                        target_id : api.getPrefs({sync: true,key:'login_id'})
                   
                },
            }
        }, function(ret, err){
            if(ret){
                // alert(JSON.stringify(ret))
                console.log('token:'+ret.data.token)
                $api.setStorage('token_api', ret.data.token);
                get_content()
            }
            
        })
    }

    function get_content(){
        api.ajax({
            url:'https://api.aibianxian.net/igame/h5/v1.51/cpa/getLuaCInfo',
            method:"GET",
            headers: {
                        'Content-Type': 'application/json;charset=utf-8',
                        'token':$api.getStorage('token_api')
                    },
        }, function(ret, err){
          
        })
    }

    function gogame() {
        //var toutiaoAd = api.require('toutiaoAd');
        //toutiaoAd.fullScreenVideo({codeId:'945739031'});
        
        // _msg('三方任务，需要对接');
        // return;
        // if (!udid_) {
        //     jumpUDID()
        // } else {
        //     console.log(999999);
        //     var browser = api.require('webBrowser');
        //     var idfa = api.require('idfa');
        //     idfa.getIDFA(function (ret, err) {
        //         if (ret.status) {

        //             console.log('确认' + udid_)
        //             idfa_ = ret.value
        //             console.log(idfa_)
        //             var MobileModel = api.deviceModel;
        //             var SysVer = api.systemVersion;
        //             var MtIDUser = MtIDUser_
        //             var MtId = MtId_
        //             var AppKey = AppKey_
        //             var UDID = udid_
        //             var sign = md5($.base64.encode(`${idfa_}#${MobileModel}#${MtIDUser}#${MtId}#${SysVer}#${UDID}#${AppKey}`))
        //             var sign_ = `${idfa_}#${MobileModel}#${MtIDUser}#${MtId}#${SysVer}#${UDID}#${AppKey}`
        //             console.log('sign_:' + sign_)
        //             browser.open({
        //                 titleBar: {
        //                     bg: '#fff',
        //                     textColor: '#333'
        //                 },
        //                 url: `https://app.91taojin.com/?MtId=${MtId}&IDFA=${idfa_}&MtIDUser=${MtIDUser}&MobileModel=${MobileModel}&SysVer=${SysVer}&UDID=${UDID}&sign=${sign}`
        //             });
        //         } else {
        //             api.alert({
        //                 msg: err.code + ' ' + err.msg
        //             });
        //         }
        //     });

        // }
    }

    function getUDID() {
        api.download({
            url: 'https://mmsw.yaoqinyun.com/mobileconfig',
            report: true,
            cache: true,
            allowResume: true
        }, function (ret, err) {
            if (ret.state == 1) {
                alert('下载成功')
            } else {
                alert(json.stringify(err))
            }
        });
    }

    function jumpUDID() {
        api.alert({
            title: '提醒',
            msg: '为验证设备唯一性 保证任务顺利进行 首次需根据提示按顺序完成安装 现前往安装界面',
        }, function (ret, err) {
            if (ret) {
                const token = $api.getStorage('token')
                if (token) {
                    api.openApp({
                        iosUrl: 'https://mmsw.yaoqinyun.com/udid/index.php',
                    });
                } else {
                    out();
                    openWin('login', null, false);
                    api.closeFrame();
                }
            }
        });
    }

    function opentrWin() {
        <!-- to_page("http://app.desjoin.com/app/index/youxi",'应用赚'); -->
        to_page("http://www.mmgs.top/v",'悬赏任务');

 
        

        // _ajax2('https://api.aibianxian.net/igame/h5/v1.51/cpa/getLuaCInfo',function(ret,err){
        //     console.log(JSON.stringify(ret))
            
        //     if(ret){
        //         console.log(window.atob(ret.data.content))
        //     }
        // },{
        //     token_api:vm.token_api
        // });
        // if (api.systemType != 'ios'){
        //     _msg('三方任务，需要对接');
        //     return
        // }
        
        // if (!udid_ || !vm.udid) {
        //     jumpUDID()
        // } else {
        //     api.openWin({
        //         name: 'trial_task',
        //         url: './trial_task.html',
        //         pageParam: {
        //             name: 'test'
        //         }
        //     });
        // }
    }


    function ceshi(){
        var uzmoduledemo = api.require('moduleDemo');
        alert(JSON.stringify(uzmoduledemo))
        var param = {msg:"Hello APICloud!"};
	        uzmoduledemo.getshebei(param, function(ret, err){
	        	alert(JSON.stringify(ret));
	        });
    }
</script>

</html>